-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
BUG: resample with asfreq ignores origin if the dataframe has a fixed frequency #62725 #62763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| exp_idx = pd.to_datetime( | ||
| [ | ||
| "2025-10-17 17:15:00", | ||
| "2025-10-17 17:16:00", | ||
| "2025-10-17 17:17:00", | ||
| ] | ||
| ).astype(result.index.dtype) # match time unit (s/us/ns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you construct a DatetimeIndex with freq= so we don't need to use check_freq=False?
| date_range("2025-10-17 17:15:00", periods=3, freq="min").astype( | ||
| result.index.dtype | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you pass a list of Timestamps to the pd.DatetimeIndex constructor and pass the dtype as well? (For context, tests should minimize the use of extraneous APIs where possible.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, updated. Thanks
|
Thanks @floura-angel |
resamplewithasfreqignoresoriginif the dataframe has a fixed frequency #62725doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.PR Summary
Bug in :meth:
DataFrame.resample.asfreqwhere fixed-frequency indexes withoriginignored alignmentand returned incorrect values. Now
originandoffsetare respected. (:issue:62725)